//
//  MGCollectionViewFlowLayout.m
//  MGPublic
//
//  Created by lhongl on 2025/10/23.
//

#import "MGCollectionViewFlowLayout.h"
@interface MGCollectionViewFlowLayout ()

///
@property (nonatomic, strong) NSMutableArray *attrsArray;

@end
@implementation MGCollectionViewFlowLayout

- (void)prepareLayout {
    [super prepareLayout];
    self.scrollDirection = UICollectionViewScrollDirectionVertical;
    self.row = self.row == 0 ? 1 :self.row;
    CGFloat width = self.collectionView.frame.size.width;
    CGFloat itemWidth = (width - self.minimumInteritemSpacing * (self.row - 1)) / self.row;
    CGFloat newItemHeight = self.itemHeight <= 0 ? itemWidth :self.itemHeight;
    self.itemSize = CGSizeMake(itemWidth , newItemHeight);
    self.minimumLineSpacing = 10;
    self.minimumInteritemSpacing = 10;
}

@end
